import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
 
const routes = [
    {
    path: '/login',
    name: 'login',
    component: ()=>import('@/views/login.vue'),
    meta: {
        title: '登录'
        }
    },
    {
      path: '/home',
      name: 'home',
      component: ()=>import('@/views/home.vue'),
      meta: {
          title: '首页'
          }
      }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location){
    return routerPush.call(this,location).catch((error)=>error)
}

export default router